package com.jl15988.simpletools.audit.model;

/**
 * 审核状态枚举
 *
 * @author jl15988
 */
public enum AuditState {
    /**
     * 待审核
     */
    PENDING(0, "待审核"),
    
    /**
     * 自动通过
     */
    AUTO_PASS(1, "自动通过"),
    
    /**
     * 人工复核
     */
    MANUAL_REVIEW(2, "人工复核"),
    
    /**
     * 审核通过
     */
    APPROVED(3, "审核通过"),
    
    /**
     * 已驳回
     */
    REJECTED(4, "已驳回");

    private final int code;
    private final String desc;

    AuditState(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    /**
     * 根据状态码获取枚举
     *
     * @param code 状态码
     * @return 枚举
     */
    public static AuditState getByCode(int code) {
        for (AuditState state : values()) {
            if (state.getCode() == code) {
                return state;
            }
        }
        return null;
    }
} 